﻿
using DemoForBillOcr;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using TaxAssistantBase;

namespace BillHelper
{
    public class SharedDataDownload
    {
        private static List<BatchInfo> _companyAll = new List<BatchInfo>();
        private static List<BatchInfo> _VendorscompanyAll = new List<BatchInfo>();
        private static List<BatchInfo> _ProductNameAll = new List<BatchInfo>();
        private static List<BatchInfo> _ProductNameContrastAll = new List<BatchInfo>();

        public static List<BatchInfo> companyAll
        {
            get
            {
                return _companyAll;
            }
        }
        public static List<BatchInfo> VendorscompanyAll
        {
            get
            {
                return _VendorscompanyAll;
            }
        }

        public static List<BatchInfo> ProductNameAll
        {
            get
            {
                return _ProductNameAll;
            }
        }
        public static List<BatchInfo> ProductNameContrastAll
        {
            get
            {
                return _ProductNameContrastAll;
            }
        }

        static SharedDataDownload()
        {
            getCompanyAllData();
        }

        //获取总公司
        public static void getCompanyAllData()
        {
            string tpresult = "";
            string apiurlhong = ApiUrlList.GetHongFengCompanyBase;
            string apiurlvendors = ApiUrlList.GetVendorsCompanyBase;
            string apiurlmxName = ApiUrlList.GetAllInvoiceProjectName;
            string apiurlmxNameContrast = ApiUrlList.GetAllInvoiceProjectNameContrast;
            string result = "";
            string result1 = "";
            string result2 = "";
            string result3 = "";
            BatchInfo bm = new BatchInfo();
            BatchInfo bmV = new BatchInfo();
            List<BatchInfo> Hbilist = new List<BatchInfo>();
            List<BatchInfo> Vbilist = new List<BatchInfo>();
            List<BatchInfo> Pbilist = new List<BatchInfo>();
            List<BatchInfo> PbiContrastlist = new List<BatchInfo>();
            try
            {
                bm.batchtimes = DeclareDateTool.currentDeclareDae;
                result1 = RestDataTool.PostVendors(out tpresult, bmV, apiurlvendors, out Vbilist);//获取供应商公司库
                if (Hbilist.Count > 0)
                {
                    _companyAll = Hbilist;
                }
                if (Vbilist.Count > 0)
                {
                    _VendorscompanyAll = Vbilist;
                }
                if (Pbilist.Count > 0)
                {
                    _ProductNameAll = Pbilist;
                }
                if (PbiContrastlist.Count > 0)
                {
                    _ProductNameContrastAll = PbiContrastlist;
                }
            }
            catch (Exception es)
            {
                WsdLogger.yxlog("error", "获取总公司库报错" + es.Message);
                return;
            }
        }
    }
}
